<?php
$cname = $_GET['cname'];

$manager = new \MongoDB\Driver\Manager('mongodb://127.0.0.1:27017');

$options = array(
	'project' => array('_id' => 0),
	'skip'=>0,
	'limit'=>10,
);

// var_dump('chat.channel'.$cname);die;

$query = new \MongoDB\Driver\Query(array(), $options);

$list = $manager->executeQuery('chat.channel'.$cname, $query);

$ret = array();

foreach ($list as $v) {
	$ret[] = json_decode($v->content, true);
}

echo json_encode($ret);